<?php

namespace App\Http\Controllers;

use App\Http\Controllers\Controller;
use App\Models\Manger\Manger;
use App\Models\Manger\Mangerrule;
use App\Models\Manger\Menulist;
use App\Services\Chanjet\ChanjetRequest;
use App\Services\DingDing\DingDingOaSer;
use App\Services\DingDing\DingDingSerTest;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Redis;

class TestController extends Controller
{

    public function dotest(){
        // DingDingSerTest::getAccessToken();
        // DingDingSerTest::getDepartmentList();
        // DingDingSerTest::getSubDepartmentList();
        // DingDingSerTest::getDepartmentInfo();

        // DingDingSerTest::getDepartmentUserIdList();
        // DingDingSerTest::getDepartmentUserInfo();

        // DingDingOaSer::getschemas();


        echo mathtoweightbyarchivetype('2*2*2', 3);exit;




        var_dump(json_decode('{ "id": 1 }'));
        var_dump(json_decode('{ "id": 1 }'));
    }

    public function dorequestapi()
    {
        $ChanjetObj = new ChanjetRequest();
        $res = $ChanjetObj->WarehouseQuery(['param'=>[""=>""]]);
        var_dump($res);
    }


    public function domenu()
    {
        $menu_ower_arr = [
            [
                'str' => '[{"path":"/admininventory","name":"admininventory","component":"Layout","hidden":false,"meta":{"title":"库存查询","icon":"user"},"children":[{"path":"inventory","component":"/admin/inventory/index","name":"inventory","meta":{"title":"库存查询","icon":"dashboard"}},{"path":"inventory-limit","component":"/admin/inventory/limits","name":"inventory-limit","meta":{"title":"库存权限设置","icon":"dashboard"},"buttonList":["保存权限"]}]},{"path":"/admin-role","name":"admin-role","component":"Layout","hidden":false,"meta":{"title":"角色管理","icon":"user"},"children":[{"path":"product","component":"/admin/addperson/product","name":"product","meta":{"title":"操盘管理","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结","重置密码"]},{"path":"procure","component":"/admin/addperson/procure","name":"procure","meta":{"title":"采购管理","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结","重置密码"]},{"path":"saleman","component":"/admin/addperson/saleman","name":"saleman","meta":{"title":"销售管理","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结","重置密码"]},{"path":"finance","component":"/admin/addperson/finance","name":"finance","meta":{"title":"统审管理","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结","重置密码"]},{"path":"cashier","component":"/admin/addperson/cashier","name":"cashier","meta":{"title":"出纳管理","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结","重置密码"]},{"path":"account","component":"/admin/addperson/account","name":"account","meta":{"title":"票务管理","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结","重置密码"]},{"path":"warehouse","component":"/admin/addperson/warehouse","name":"warehouse","meta":{"title":"仓库管理","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结","重置密码"]}]},{"path":"/admin-limit","name":"admin-limit","component":"Layout","hidden":false,"meta":{"title":"分配权限","icon":"user"},"children":[{"path":"limitproduct","component":"/admin/limit/product","name":"limitproduct","meta":{"title":"操盘组","icon":"dashboard"},"buttonList":["权限编辑","查看"]},{"path":"limitprocur","component":"/admin/limit/procure","name":"limitprocure","meta":{"title":"采购组","icon":"dashboard"},"buttonList":["权限编辑","查看"]},{"path":"limitsaleman","component":"/admin/limit/saleman","name":"limitsaleman","meta":{"title":"销售组","icon":"dashboard"},"buttonList":["权限编辑","查看"]},{"path":"limitfinance","component":"/admin/limit/finance","name":"limitfinance","meta":{"title":"统审组","icon":"dashboard"},"buttonList":["权限编辑","查看"]},{"path":"limitcashier","component":"/admin/limit/cashier","name":"limitcashier","meta":{"title":"出纳组","icon":"dashboard"},"buttonList":["权限编辑","查看"]},{"path":"limitaccount","component":"/admin/limit/account","name":"limitaccount","meta":{"title":"票务组","icon":"dashboard"},"buttonList":["权限编辑","查看"]},{"path":"limitwarehouse","component":"/admin/limit/warehouse","name":"limitwarehouse","meta":{"title":"仓库组","icon":"dashboard"},"buttonList":["权限编辑","查看"]}]},{"path":"/adminbasic","name":"adminbasic","component":"Layout","hidden":false,"meta":{"title":"基础信息","icon":"user"},"children":[{"path":"adminsupplier","component":"/admin/customer/supplier","name":"adminsupplier","meta":{"title":"供应商管理","icon":"dashboard"},"buttonList":["导出","查看"]},{"path":"admincustom","component":"/admin/customer/custom","name":"admincustom","meta":{"title":"客户管理","icon":"dashboard"},"buttonList":["导出","查看"]},{"path":"adminsteels","name":"adminsteels","component":"ParentView","hidden":false,"meta":{"title":"存货管理","icon":"user"},"children":[{"path":"steelsclass","component":"/admin/steels/steelsclass","name":"steelsclass","meta":{"title":"钢材分类","icon":"dashboard"},"buttonList":["新增","新增子分类"]},{"path":"steelsfiles","component":"/admin/steels/steelsfiles","name":"steelsfiles","meta":{"title":"钢材档案","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载","冻结"]},{"path":"steelssort-breed","component":"/admin/steels/sort","name":"steelssort-breed","meta":{"title":"品种","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":1}},{"path":"steelssort-mate","component":"/admin/steels/sort","name":"steelssort-mate","meta":{"title":"材质","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":2}},{"path":"steelssort-mill","component":"/admin/steels/sort","name":"steelssort-mill","meta":{"title":"钢厂","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":3}},{"path":"steelssort-add","component":"/admin/steels/add","name":"steelssort-add","meta":{"title":"新增","icon":"dashboard"},"buttonList":["新增"]}]},{"path":"/adminsettlement","name":"adminsettlement","component":"ParentView","hidden":false,"meta":{"title":"结算管理","icon":"user"},"children":[{"path":"settlement-company","component":"/admin/settlement/company","name":"settlement-company","meta":{"title":"结算公司","icon":"dashboard"},"buttonList":["新增","修改","冻结"]},{"path":"settlement-way","component":"/admin/settlement/way","name":"settlement-way","meta":{"title":"结算方式","icon":"dashboard"},"buttonList":["新增","修改","冻结"]}]},{"path":"house-list","component":"/admin/house/houselist","name":"house-list","meta":{"title":"仓库管理","icon":"dashboard"},"buttonList":["新增","冻结"]},{"path":"basic-statistics","name":"basic-statistics","component":"ParentView","hidden":false,"meta":{"title":"统审端基础信息管理","icon":"user"},"children":[{"path":"statistics-balance","name":"statistics-balance","component":"ParentView","hidden":false,"meta":{"title":"期初余额","icon":"user"},"children":[{"path":"balance-supplier","component":"/admin/statistics/balance/supplier","name":"balance-supplier","meta":{"title":"供应商余额","icon":"dashboard"}},{"path":"balance-client","component":"/admin/statistics/balance/client","name":"balance-client","meta":{"title":"客户余额","icon":"dashboard"}}]},{"path":"statistics-purchase","component":"/admin/statistics/purchase","name":"statistics-statistics","meta":{"title":"采购费用","icon":"dashboard"}},{"path":"statistics-sale","component":"/admin/statistics/sale","name":"statistics-sale","meta":{"title":"销售费用","icon":"dashboard"}},{"path":"statistics-else","component":"/admin/statistics/else","name":"statistics-else","meta":{"title":"其他费用","icon":"dashboard"}},{"path":"statistics-analyse","component":"/admin/statistics/analyse","name":"statistics-analyse","meta":{"title":"客户分析","icon":"dashboard"}}]},{"path":"basic-stock","name":"basic-stock","component":"ParentView","hidden":false,"meta":{"title":"操盘端基础信息管理","icon":"user"},"children":[{"path":"stock-orderfinish","component":"/admin/stock/orderfinish","name":"stock-orderfinish","meta":{"title":"订单结束","icon":"dashboard"}},{"path":"stock-receivable","component":"/admin/stock/receivable","name":"stock-receivable","meta":{"title":"报车应收","icon":"dashboard"}},{"path":"stock-inventory","component":"/admin/stock/inventory","name":"stock-inventory","meta":{"title":"库存计提","icon":"dashboard"}},{"path":"stock-self","component":"/admin/stock/self","name":"stock-self","meta":{"title":"自采计提","icon":"dashboard"}}]}]},{"path":"/adminreport","name":"adminreport","component":"Layout","hidden":false,"meta":{"title":"可视分析","icon":"user"},"children":[{"path":"yoy","component":"/product/statement/yoy","name":"yoy","meta":{"title":"同比","icon":" "}},{"path":"qoq","component":"/product/statement/qoq","name":"qoq","meta":{"title":"环比","icon":" "}},{"path":"report-pricetrend","component":"/admin/reportform/pricetrend","name":"report-pricetrend","meta":{"title":"价格走势","icon":"dashboard"}},{"path":"report-purchase","component":"/admin/reportform/purchase","name":"report-purchase","meta":{"title":"采购概况","icon":"dashboard"}},{"path":"report-sale","component":"/admin/reportform/sale","name":"report-sale","meta":{"title":"销售概况","icon":"dashboard"}},{"path":"grossProfit","component":"/product/statement/grossProfit","name":"grossProfit","meta":{"title":"毛利分析表","icon":" "}},{"path":"report-inventory","component":"ParentView","name":"report-inventory","meta":{"title":"库存分析","icon":"dashboard"},"children":[{"path":"turnoverRate","component":"/product/inventoryAnalysis/turnoverRate","name":"turnoverRate","meta":{"title":"库存周转率","icon":" "}},{"path":"warehouseAge","component":"/product/inventoryAnalysis/warehouseAge","name":"warehouseAge","meta":{"title":"库龄分析","icon":" "}},{"path":"dullInventory","component":"/product/inventoryAnalysis/dullInventory","name":"dullInventory","meta":{"title":"呆滞存货分析表","icon":" "}}]}]},{"path":"/adminform","name":"adminform","component":"Layout","hidden":false,"meta":{"title":"表单设计","icon":"user"},"children":[{"path":"form-purchase","component":"ParentView","name":"form-purchase","meta":{"title":"采购端","icon":"dashboard"},"children":[{"path":"form-purchase-order","component":"/admin/form/purchase/order","name":"form-purchase-order","meta":{"title":"采购订单","icon":"dashboard"}},{"path":"form-purchase-stock","component":"/admin/form/purchase/stock","name":"form-purchase-stock","meta":{"title":"进货单","icon":"dashboard"}},{"path":"form-purchase-beput","component":"/admin/form/purchase/beput","name":"form-purchase-beput","meta":{"title":"采购入库单","icon":"dashboard"}}]},{"path":"form-sale","component":"ParentView","name":"form-sale","meta":{"title":"销售端","icon":"dashboard"},"children":[{"path":"form-sale-order","component":"/admin/form/purchase/order","name":"form-sale-order","meta":{"title":"销售订单","icon":"dashboard"}},{"path":"form-sale-deliver","component":"/admin/form/purchase/deliver","name":"form-sale-deliver","meta":{"title":"销售发货单","icon":"dashboard"}},{"path":"form-sale-outbound","component":"/admin/form/purchase/outbound","name":"form-sale-outbound","meta":{"title":"销售出库单","icon":"dashboard"}}]}]},{"path":"/admintemplate","name":"admintemplate","component":"Layout","hidden":false,"meta":{"title":"模板管理","icon":"user"},"children":[{"path":"template-contract","component":"/admin/settemplate/contract","name":"template-contract","meta":{"title":"合同模板","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结"]},{"path":"template-carfrom","component":"/admin/settemplate/carfrom","name":"template-carfrom","meta":{"title":"报车单模板","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结"]},{"path":"template-chapter","component":"/admin/settemplate/chapter","name":"template-chapter","meta":{"title":"合同章印鉴管理","icon":"dashboard"},"buttonList":["新增","修改","查看","冻结"]}]},{"path":"/adminprovision","name":"adminprovision","component":"Layout","hidden":false,"meta":{"title":"计提管理","icon":"user"},"children":[{"path":"provision-inventory","component":"/admin/provision/inventory","name":"provision-inventory","meta":{"title":"库存产品计提加成","icon":"dashboard"}},{"path":"provision-oneself","component":"/admin/provision/oneself","name":"provision-oneself","meta":{"title":"自采计提扣减成本","icon":"dashboard"}}]}]',
                'menu_ower' => 1
            ],
            [
                'str' => '[{"path":"/inventoryQuery","component":"Layout","hidden":false,"meta":{"title":"库存查询","icon":""},"children":[{"path":"inventoryQueryIndex","component":"/product/inventoryQuery/index","name":"inventoryQueryIndex","meta":{"title":"库存查询","icon":""}}]},{"path":"/saleChargeRule","component":"Layout","hidden":false,"meta":{"title":"销售定价","icon":""},"children":[{"path":"sale","component":"/product/saleChargeRule/sale","name":"sale","meta":{"title":"销售定价","icon":""}},{"path":"dealRecord","component":"/product/saleChargeRule/dealRecord","name":"dealRecord","meta":{"title":"成交记录","icon":""}},{"path":"basePriceHistory","component":"/product/saleChargeRule/basePriceHistory","name":"basePriceHistory","meta":{"title":"基价历史","icon":""}}]},{"path":"/examineAndVerify","component":"Layout","hidden":false,"meta":{"title":"审核待办","icon":""},"children":[{"path":"salesReturns","component":"/product/examineAndVerify/salesReturns","name":"salesReturns","meta":{"title":"销售退货审核","icon":""}},{"path":"belowGuidePrice","component":"/product/examineAndVerify/belowGuidePrice","name":"belowGuidePrice","meta":{"title":"低于指导价审核","icon":""}},{"path":"deleSaleOrderExamine","component":"/product/examineAndVerify/deleSaleOrderExamine","name":"deleSaleOrderExamine","meta":{"title":"删除销售订单审核","icon":""}},{"path":"orderDifference","component":"/product/examineAndVerify/orderDifference","name":"orderDifference","meta":{"title":"订单差额较大审核","icon":""}},{"path":"saleOrderExamine","component":"/product/examineAndVerify/saleOrderExamine","name":"saleOrderExamine","meta":{"title":"销售订单审核","icon":""}}]},{"path":"/claim","component":"Layout","hidden":false,"meta":{"title":"款项查询"},"children":[{"path":"subscription","component":"/salesman/claim/subscription","name":"subscription","meta":{"title":"收款池","icon":""}},{"path":"collection","component":"/salesman/claim/collection","name":"collection","meta":{"title":"收款列表","icon":""}},{"path":"customBalance","component":"/salesman/claim/customBalance","name":"customBalance","meta":{"title":"客户余额表","icon":""}},{"path":"collectionReconciliation","component":"/salesman/claim/collectionReconciliation","name":"collectionReconciliation","meta":{"title":"出库收款对账单","icon":""}},{"path":"payment-list","component":"/procurement/money-inquiry/payment-list","name":"payment-list","meta":{"title":"付款列表","icon":""}},{"path":"supplier-balance-sheet","component":"/procurement/money-inquiry/supplier-balance-sheet","name":"supplier-balance-sheet","meta":{"title":"供应商余额表","icon":""}},{"path":"deposit-payment-reconciliation","component":"/procurement/money-inquiry/deposit-payment-reconciliation","name":"deposit-payment-reconciliation","meta":{"title":"入库付款对账单","icon":""}}]},{"path":"/procuremanage","component":"Layout","hidden":false,"meta":{"title":"采购管理","icon":""},"children":[{"path":"ContractArchive","component":"ParentView","meta":{"title":"合同档案库","icon":""},"children":[{"path":"yearly-agreement","component":"/procurement/purchasing-management/yearly-agreement","name":"yearly-agreement","meta":{"title":"年度协议","icon":""}},{"path":"monthly-agreement","component":"/procurement/purchasing-management/monthly-agreement","name":"monthly-agreement","meta":{"title":"月度协议","icon":""}},{"path":"procuremanageContractArchive","component":"/product/procuremanage/ContractArchive","name":"procuremanageContractArchive","meta":{"title":"公司集采","icon":""}},{"path":"BusinessSelfProcurement","component":"/product/procuremanage/BusinessSelfProcurement","name":"BusinessSelfProcurement","meta":{"title":"业务集采","icon":""}}]},{"path":"purchase-order-on","component":"/procurement/order-management/purchase-order","name":"purchase-order-on","meta":{"title":"采购订货单","icon":""}},{"path":"purchase-order","component":"/procurement/purchase-order-management/purchase-order","name":"purchase-order","meta":{"title":"采购进货单","icon":""}},{"path":"purchase-order","component":"/procurement/purchase-order-management/purchase-order","name":"purchase-order","meta":{"title":"采购入库单","icon":""}},{"path":"final-statement","component":"/procurement/purchase-order-management/final-statement","name":"final-statement","meta":{"title":"采购结算单","icon":""}}]},{"path":"/salemanage","component":"Layout","hidden":false,"meta":{"title":"销售管理","icon":""},"children":[{"path":"saleOrder","component":"/salesman/sale/saleOrder","name":"saleOrder","meta":{"title":"销售订货单","icon":""}},{"path":"sendoutgoods","component":"/salesman/salesManage/index","name":"sendoutgoods","meta":{"title":"销售发货单","icon":""}},{"path":"salesOutbound","component":"/salesman/salesOutbound/index","name":"salesOutbound","meta":{"title":"销售出库单","icon":""}},{"path":"settlement","component":"/salesman/salesOutbound/settlement","name":"settlement","meta":{"title":"销售结算单","icon":""}}]},{"path":"/dailyUnifiedPricing","component":"Layout","hidden":false,"meta":{"title":"每日统价","icon":""},"children":[{"path":"dailyUnifiedPricingIndex","component":"/product/dailyUnifiedPricing/index","name":"dailyUnifiedPricingIndex","meta":{"title":"后结算价","icon":""}},{"path":"forwardPrice","component":"/product/dailyUnifiedPricing/forward-price","name":"forwardPrice","meta":{"title":"期货价格","icon":""}},{"path":"websitePrice","component":"/product/dailyUnifiedPricing/website-price","name":"websitePrice","meta":{"title":"网站价格","icon":""}}]},{"path":"/statement","component":"Layout","hidden":false,"meta":{"title":"可视分析","icon":""},"children":[{"path":"yoy","component":"/product/statement/yoy","name":"yoy","meta":{"title":"同比","icon":""}},{"path":"qoq","component":"/product/statement/qoq","name":"qoq","meta":{"title":"环比","icon":""}},{"path":"price-trend","component":"/product/statement/price-trend","name":"price-trend","meta":{"title":"价格走势","icon":""}},{"path":"procurement-overview","component":"/product/statement/procurement-overview","name":"procurement-overview","meta":{"title":"采购概况","icon":""}},{"path":"sales-overview","component":"/product/statement/sales-overview","name":"sales-overview","meta":{"title":"销售概况","icon":""}},{"path":"grossProfit","component":"/product/statement/grossProfit","name":"grossProfit","meta":{"title":"毛利分析表","icon":""}},{"path":"InventoryAnalysis","component":"ParentView","meta":{"title":"库存分析","icon":""},"children":[{"path":"turnoverRate","component":"/product/inventoryAnalysis/turnoverRate","name":"turnoverRate","meta":{"title":"库存周转率","icon":""}},{"path":"warehouseAge","component":"/product/inventoryAnalysis/warehouseAge","name":"warehouseAge","meta":{"title":"库龄分析","icon":""}},{"path":"dullInventory","component":"/product/inventoryAnalysis/dullInventory","name":"dullInventory","meta":{"title":"呆滞存货分析表","icon":""}}]}]},{"path":"/ruleSettings","component":"Layout","hidden":false,"meta":{"title":"规则制定","icon":""},"children":[{"path":"order-end","component":"/product/ruleSettings/order-end","name":"order-end","meta":{"title":"订单结束","icon":""}},{"path":"reported-car-receivables","component":"/product/ruleSettings/reported-car-receivables","name":"reported-car-receivables","meta":{"title":"报车应收","icon":""}},{"path":"accrual-bonus","component":"/product/ruleSettings/accrual-bonus","name":"accrual-bonus","meta":{"title":"库存产品计提加成","icon":""}},{"path":"deducting-costs","component":"/product/ruleSettings/deducting-costs","name":"deducting-costs","meta":{"title":"自采计提扣减成本","icon":""}}]}]',
                'menu_ower' => 2
            ],
            [
                'str' => '[{"path":"/taxaccount-view","name":"taxaccount-view","component":"Layout","hidden":false,"meta":{"title":"客户档案","icon":"user"},"children":[{"path":"invoicreview","component":"/taxaccount/invoic/invoicreview","name":"invoicreview","meta":{"title":"客户档案","icon":"dashboard"},"buttonList":["查看","通过","驳回"]}]},{"path":"/taxaccount-enter","name":"taxaccount-enter","component":"Layout","hidden":false,"meta":{"title":"采购入库单","icon":"user"},"children":[{"path":"saleenterorder","component":"/taxaccount/saleorder/saleenterorder","name":"saleenterorder","meta":{"title":"采购入库单","icon":"dashboard"}}]},{"path":"/taxaccount-out","name":"taxaccount-out","component":"Layout","hidden":false,"meta":{"title":"销售出库单","icon":"user"},"children":[{"path":"saleoutorder","component":"/taxaccount/saleorder/saleoutorder","name":"saleoutorder","meta":{"title":"销售出库单","icon":"dashboard"},"buttonList":["开票","查看合同","批量开票","批量审核","取消开票","审核","查看","导出"]}]},{"path":"/admininventory","name":"admininventory","component":"Layout","hidden":false,"meta":{"title":"库存查询","icon":"user"},"children":[{"path":"inventory","component":"/admin/inventory/index","name":"inventory","meta":{"title":"库存查询","icon":"dashboard"}}]},{"path":"/messagenotice","component":"Layout","hidden":false,"meta":{"title":"消息通知","icon":""},"children":[{"path":"messagenotice","component":"/salesman/message/notice","name":"messagenotice","meta":{"title":"消息通知","icon":""}}]}]',
                'menu_ower' => 3
            ],
            [
                'str' => '[{"path":"/basic-information-management-finance","component":"Layout","name":"basicInformationManagementFinance","hidden":false,"meta":{"title":"基本信息管理","icon":"tree"},"children":[{"path":"basic-information-finance","component":"/procurement/basic-information-management/basic-information","name":"basicInformationFinance","buttonlist":["新建","导入","通过","驳回","查看"],"meta":{"title":"基本信息"}},{"path":"variety-finance","component":"/procurement/basic-information-management/variety","name":"varietyFinance","buttonlist":["新建","导出","导入"],"meta":{"title":"品种"}},{"path":"texture-finance","component":"/procurement/basic-information-management/texture","name":"textureFinance","buttonlist":["新建","导出","导入"],"meta":{"title":"材质"}},{"path":"steel-mill-finance","component":"/procurement/basic-information-management/steel-mill","name":"steelMillFinance","buttonlist":["新建","导出","导入"],"meta":{"title":"钢厂"}}]},{"path":"/claim-form-management","name":"claimFormManagement","component":"Layout","hidden":false,"meta":{"title":"认领单管理","icon":"system"},"children":[{"path":"claim-form","component":"/finance/claim-form-management/index","name":"claimFormManagement","buttonlist":["新建","发出认领单","查看","修改","删除","撤回","平账"],"meta":{"title":"认领单管理","icon":"system"}}]},{"path":"/warehousing-approval-management","name":"warehousingApprovalManagement","component":"Layout","hidden":false,"meta":{"title":"入库单审批管理","icon":"table"},"children":[{"path":"claim-form","component":"/finance/warehousing-approval-management/index","name":"warehousingApprovalManagement","buttonlist":["通过","驳回","查看"],"meta":{"title":"入库单审批管理","icon":"table"}}]},{"path":"/sold-note-management","name":"soldNoteManagement","component":"Layout","hidden":false,"meta":{"title":"销售管理单据","icon":"tree-table"},"children":[{"path":"sales-slip","component":"/finance/sold-note-management/sales-slip","name":"salesSlip","meta":{"title":"销售发票"}},{"path":"sale-out-of-warehouse","component":"/finance/sold-note-management/sale-out-of-warehouse","name":"saleOutOfWarehouse","meta":{"title":"销售出库单"}}]},{"path":"/purchasing-management-bills","name":"purchasingManagementBills","component":"Layout","hidden":false,"meta":{"title":"采购管理单据","icon":"wechat"},"children":[{"path":"purchasing-management-bills-index","component":"/finance/purchasing-management-bills/index","name":"purchasingManagementBillsIndex","meta":{"title":"采购发票"}}]},{"path":"/initial-balance","name":"initialBalance","component":"Layout","hidden":false,"meta":{"title":"期初余额","icon":"list"},"children":[{"path":"initial-supplier-balance","component":"/finance/initial-balance/supplier-balance","name":"initialSupplierBalance","buttonlist":["修改期初余额"],"meta":{"title":"供应商余额","icon":"guide"}},{"path":"initial-customer-balance","component":"/finance/initial-balance/customer-balance","name":"initialCustomerBalance","buttonlist":["修改期初余额"],"meta":{"title":"客户余额","icon":"international"}}]},{"path":"/balance-statement","name":"balanceStatement","component":"Layout","hidden":false,"meta":{"title":"余额流水","icon":"dict"},"children":[{"path":"supplier-balance","component":"/finance/balance-statement/supplier-balance","name":"supplierBalance","meta":{"title":"供应商余额","icon":"example"}},{"path":"customer-balance","component":"/finance/balance-statement/customer-balance","name":"customerBalance","meta":{"title":"客户余额","icon":"edit"}}]},{"path":"/finance-stock-inquiry","name":"financeStockInquiry","component":"Layout","hidden":false,"meta":{"title":"库存查询","icon":"documentation"},"children":[{"path":"finance-stock-inquiry-index","component":"/finance/stock-inquiry/index","name":"financeStockInquiryIndex","buttonlist":["修改采购价-加价","理计查看可用件数"],"meta":{"title":"库存查询","icon":"documentation"}}]},{"path":"/adminbasic","name":"adminbasic","component":"Layout","hidden":false,"meta":{"title":"基础信息","icon":"user"},"children":[{"path":"adminsupplier","component":"/admin/customer/supplier","name":"adminsupplier","meta":{"title":"供应商档案","icon":"dashboard"},"buttonList":["导出","查看"]},{"path":"admincustom","component":"/admin/customer/custom","name":"admincustom","meta":{"title":"客户档案","icon":"dashboard"},"buttonList":["导出","查看"]},{"path":"house-list","component":"/admin/house/houselist","hidden":false,"name":"house-list","meta":{"title":"仓库档案","icon":"dashboard"},"buttonList":["新增","冻结"]},{"path":"adminsteels","name":"adminsteels","component":"ParentView","hidden":false,"meta":{"title":"存货档案","icon":"user"},"children":[{"path":"steelsclass","component":"/admin/steels/steelsclass","name":"steelsclass","meta":{"title":"钢材分类","icon":"dashboard"},"buttonList":["新增","新增子分类"]},{"path":"steelsfiles","component":"/admin/steels/steelsfiles","name":"steelsfiles","meta":{"title":"钢材名称","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载","修改","冻结"]},{"path":"steelssort-breed","component":"/admin/steels/sort","name":"steelssort-breed","meta":{"title":"品种","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":1}},{"path":"steelssort-mate","component":"/admin/steels/sort","name":"steelssort-mate","meta":{"title":"材质","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":2}},{"path":"steelssort-mill","component":"/admin/steels/sort","name":"steelssort-mill","meta":{"title":"钢厂","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":3}},{"path":"steelssort-add","component":"/admin/steels/add","name":"steelssort-add","meta":{"title":"新增","icon":"dashboard"},"buttonList":["新增"]}]},{"path":"statistics-balance","name":"statistics-balance","component":"ParentView","hidden":false,"meta":{"title":"期初余额","icon":"user"},"children":[{"path":"balance-supplier","component":"/admin/statistics/balance/supplier","name":"balance-supplier","meta":{"title":"供应商余额","icon":"dashboard"}},{"path":"balance-client","component":"/admin/statistics/balance/client","name":"balance-client","meta":{"title":"客户余额","icon":"dashboard"}}]},{"path":"statistics-purchase","component":"/admin/statistics/purchase","name":"statistics-statistics","meta":{"title":"采购费用","icon":"dashboard"}},{"path":"statistics-sale","component":"/admin/statistics/sale","name":"statistics-sale","meta":{"title":"销售费用","icon":"dashboard"}},{"path":"statistics-else","component":"/admin/statistics/else","name":"statistics-else","meta":{"title":"其他费用","icon":"dashboard"}}]}]',
                'menu_ower' => 4
            ],
            [
                'str' => '[{"path":"/warehouseend","component":"Layout","hidden":false,"meta":{"title":"仓库列表","icon":"user"},"children":[{"path":"houselist","component":"/warehouseend/houselist/index","name":"houselist","meta":{"title":"仓库列表","icon":"dashboard"}}]},{"path":"/warehouseend","component":"Layout","hidden":false,"meta":{"title":"现存量","icon":"user"},"children":[{"path":"oredr-xiancun","component":"/warehouseend/order/xiancun","name":"oredr-xiancun","meta":{"title":"现存量","icon":"dashboard"}}]},{"path":"/warehouseend","component":"Layout","hidden":false,"meta":{"title":"调拨单","icon":"user"},"children":[{"path":"oredr-diaobo","component":"/warehouseend/order/diaobo","name":"oredr-diaobo","meta":{"title":"调拨单","icon":"dashboard"}}]},{"path":"/warehouseend","component":"Layout","hidden":false,"meta":{"title":"其他入库","icon":"user"},"children":[{"path":"inlibraryorder","component":"/warehouseend/library/inlibraryorder","name":"inlibraryorder","meta":{"title":"其他入库","icon":"dashboard"}}]},{"path":"/warehouseend","component":"Layout","hidden":false,"meta":{"title":"其他出库","icon":"user"},"children":[{"path":"outlibraryorder","component":"/warehouseend/library/outlibraryorder","name":"outlibraryorder","meta":{"title":"其他出库","icon":"dashboard"}}]},{"path":"/admininventory","name":"admininventory","component":"Layout","hidden":false,"meta":{"title":"库存查询","icon":"user"},"children":[{"path":"inventory","component":"/admin/inventory/index","name":"inventory","meta":{"title":"库存查询","icon":"dashboard"}}]}]',
                'menu_ower' => 5
            ],
            [
                'str' => '[{"path":"/procurement-stock-inquiry","component":"Layout","hidden":false,"meta":{"title":"库存查询","icon":"search"},"children":[{"path":"index","component":"/procurement/stock-inquiry/index","name":"procurementStockInquiry","meta":{"title":"库存查询"}}]},{"path":"/purchasing-management","name":"purchasingManagement","component":"Layout","hidden":false,"meta":{"title":"合同档案库","icon":"textarea"},"children":[{"path":"yearly-agreement","component":"/procurement/purchasing-management/yearly-agreement","name":"yearlyAgreement","buttonlist":["新建","修改","删除"],"meta":{"title":"年度协议"}},{"path":"monthly-agreement","component":"/procurement/purchasing-management/monthly-agreement","name":"monthlyAgreement","buttonlist":["新建","修改","删除"],"meta":{"title":"月底协议"}},{"path":"company-acquisition-agreement","component":"/procurement/purchasing-management/company-acquisition-agreement","name":"companyAcquisitionAgreement","buttonlist":["新建","修改","删除"],"meta":{"title":"公司集采"}},{"path":"business-acquisition-agreement","component":"/procurement/purchasing-management/business-acquisition-agreement","name":"businessAcquisitionAgreement","buttonlist":["新建","修改","删除"],"meta":{"title":"业务自采"}}]},{"path":"/order-management","name":"orderManagement","component":"Layout","hidden":false,"meta":{"title":"采购订货单","icon":"redis-list"},"children":[{"path":"purchase-order-on","component":"/procurement/order-management/purchase-order","name":"purchaseOrderOn","buttonlist":["申请付款","新建","生成","查看","修改","绑定"],"meta":{"title":"采购订货单列表","icon":"theme"}}]},{"path":"/purchase-order-management","component":"Layout","name":"purchaseOrderManagementStock","hidden":false,"meta":{"title":"采购进货单","icon":"button"},"children":[{"path":"purchase-order","component":"/procurement/purchase-order-management/purchase-order","name":"purchaseOrder","buttonlist":["批量删除","生成","修改","查看","删除"],"meta":{"title":"采购进货单","icon":"lock"}}]},{"path":"/purchase-order-management","component":"Layout","name":"purchaseOrderManagementIn","hidden":false,"meta":{"title":"采购入库单","icon":"button"},"children":[{"path":"warehouse-warrant","component":"/procurement/purchase-order-management/warehouse-warrant","name":"warehouseWarrant","buttonlist":["生成","撤审","查看","修改","提交审核"],"meta":{"title":"采购入库单","icon":"message"}}]},{"path":"/purchase-order-management","component":"Layout","name":"purchaseOrderManagement","hidden":false,"meta":{"title":"采购结算单","icon":"button"},"children":[{"path":"final-statement","component":"/procurement/purchase-order-management/final-statement","name":"finalStatement","meta":{"title":"采购结算单","icon":"online"}},{"path":"pre-final-statement","component":"/procurement/purchase-order-management/pre-final-statement","name":"preFinalStatement","buttonlist":["批量计价","重新计价"],"meta":{"title":"采购预结算单","icon":"money"}}]},{"path":"/executive-condition","component":"Layout","name":"executiveCondition","hidden":false,"meta":{"title":"采购订单执行表","icon":"language"},"children":[{"path":"order-executive-condition","component":"/procurement/order-executive-condition/index","name":"orderExecutiveCondition","buttonlist":["查看","完结","一键完结"],"meta":{"title":"采购订单执行表","icon":"language"}}]},{"path":"/money-inquiry","component":"Layout","name":"moneyInquiry","hidden":false,"meta":{"title":"款项查询","icon":"druid"},"children":[{"path":"payment-list","component":"/procurement/money-inquiry/payment-list","name":"paymentList","meta":{"title":"付款列表"}},{"path":"supplier-balance-sheet","component":"/procurement/money-inquiry/supplier-balance-sheet","name":"supplierBalanceSheet","meta":{"title":"供应商余额表"}},{"path":"deposit-payment-reconciliation","component":"/procurement/money-inquiry/deposit-payment-reconciliation","name":"depositPaymentReconciliation","meta":{"title":"入库付款对账单"}}]},{"path":"/warehouseend","component":"Layout","name":"warehouseend","hidden":false,"meta":{"title":"库存调整单","icon":"druid"},"children":[{"path":"inlibraryorder","component":"/warehouseend/library/inlibraryorder","name":"inlibraryorder","meta":{"title":"其他入库单"}},{"path":"outlibraryorder","component":"/warehouseend/library/outlibraryorder","name":"outlibraryorder","meta":{"title":"其他出库单"}},{"path":"oredr-diaobo","component":"/warehouseend/order/diaobo","name":"oredr-diaobo","meta":{"title":"调拨单"}}]},{"path":"/adminbasic","name":"adminbasic","component":"Layout","hidden":false,"meta":{"title":"基础信息","icon":"user"},"children":[{"path":"adminsupplier","component":"/admin/customer/supplier","name":"adminsupplier","meta":{"title":"供应商档案","icon":"dashboard"},"buttonList":["导出","查看"]},{"path":"adminsteels","name":"adminsteels","component":"ParentView","hidden":false,"meta":{"title":"存货档案","icon":"user"},"children":[{"path":"steelsclass","component":"/admin/steels/steelsclass","name":"steelsclass","meta":{"title":"钢材分类","icon":"dashboard"},"buttonList":["新增","新增子分类"]},{"path":"steelsfiles","component":"/admin/steels/steelsfiles","name":"steelsfiles","meta":{"title":"钢材名称","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载","冻结"]},{"path":"steelssort-breed","component":"/admin/steels/sort","name":"steelssort-breed","meta":{"title":"品种","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":1}},{"path":"steelssort-mate","component":"/admin/steels/sort","name":"steelssort-mate","meta":{"title":"材质","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":2}},{"path":"steelssort-mill","component":"/admin/steels/sort","name":"steelssort-mill","meta":{"title":"钢厂","icon":"dashboard"},"buttonList":["新增","导入","导出","模板下载"],"props":{"id":3}}]},{"path":"house-list","component":"/admin/house/houselist","name":"house-list","meta":{"title":"仓库档案","icon":"dashboard"},"buttonList":["新增","冻结"]}]}]',
                'menu_ower' => 6
            ],
            [
                'str' => '[{"path":"/inventory","component":"Layout","hidden":false,"meta":{"title":"库存查询","icon":""},"children":[{"path":"inventoryIndex","component":"/salesman/inventory/index","name":"inventoryIndex","meta":{"title":"库存查询","icon":""}}]},{"path":"/claim","component":"Layout","hidden":false,"meta":{"title":"款项查询"},"children":[{"path":"subscription","component":"/salesman/claim/subscription","name":"subscription","meta":{"title":"收款池","icon":""}},{"path":"collection","component":"/salesman/claim/collection","name":"collection","meta":{"title":"收款列表","icon":""}},{"path":"refundOrder","component":"/salesman/sale/refundOrder","name":"refundOrder","meta":{"title":"退款列表","icon":""}},{"path":"orderCostPayment","component":"/salesman/claim/orderCostPayment","name":"orderCostPayment","meta":{"title":"销售费用付款表","icon":""}},{"path":"customBalance","component":"/salesman/claim/customBalance","name":"customBalance","meta":{"title":"客户余额表","icon":""}},{"path":"collectionReconciliation","component":"/salesman/claim/collectionReconciliation","name":"collectionReconciliation","meta":{"title":"出库收款对账单","icon":""}}]},{"path":"/sale","component":"Layout","hidden":false,"meta":{"title":"销售订货单"},"children":[{"path":"saleOrder","component":"/salesman/sale/saleOrder","name":"saleOrder","meta":{"title":"销售订单列表","icon":""}},{"path":"preOpening","component":"/salesman/sale/preOpening","name":"preOpening","meta":{"title":"申请预开发票","icon":""}}]},{"path":"/salesManage","component":"Layout","meta":{"title":"销售发货单"},"hidden":false,"children":[{"path":"index","component":"/salesman/salesManage/index","name":"index","meta":{"title":"销售发货单","icon":""}}]},{"path":"/salesOutbound","component":"Layout","hidden":false,"meta":{"title":"销售出库单","icon":""},"children":[{"path":"index","component":"/salesman/salesOutbound/index","name":"salesIndex","meta":{"title":"销售出库单","icon":""}},{"path":"contractSummary","component":"/salesman/salesOutbound/contractSummary","name":"contractSummary","meta":{"title":"合同汇总","icon":""}}]},{"path":"/tuihuoManage","component":"Layout","hidden":false,"meta":{"title":"销售退货单","icon":""},"children":[{"path":"salesReturnsOrder","component":"/salesman/tuihuoManage/salesReturnsOrder","name":"salesReturnsOrder","meta":{"title":"销售退货单","icon":""}}]},{"path":"/ordersettlement","component":"Layout","hidden":false,"meta":{"title":"销售结算单","icon":""},"children":[{"path":"settlement","component":"/salesman/salesOutbound/settlement","name":"settlement","meta":{"title":"销售结算单","icon":""}}]},{"path":"/orderexecute","component":"Layout","hidden":false,"meta":{"title":"销售订单执行表","icon":""},"children":[{"path":"implementation","component":"/salesman/saleOrderExecuteSituation/implementation","name":"implementation","meta":{"title":"销售订单执行表","icon":""}}]},{"path":"/basicInfo","component":"Layout","hidden":false,"meta":{"title":"基础信息管理"},"children":[{"path":"custom","component":"/salesman/basicInfo/custom","name":"custom","meta":{"title":"客户档案","icon":""}},{"path":"customAnalysis","component":"/salesman/basicInfo/customAnalysis","name":"customAnalysis","meta":{"title":"客户分析","icon":""}}]},{"path":"/messagenotice","component":"Layout","hidden":false,"meta":{"title":"消息通知","icon":""},"children":[{"path":"messagenotice","component":"/salesman/message/notice","name":"messagenotice","meta":{"title":"消息通知","icon":""}}]}]',
                'menu_ower' => 7
            ],
            [
                'str' => '[{"path":"/cashire","component":"Layout","hidden":false,"meta":{"title":"采购货款","icon":"user"},"children":[{"path":"purchase","component":"/cashire/purchase","name":"purchase","meta":{"title":"采购货款","icon":"user"}}]},{"path":"/cashire","component":"Layout","hidden":false,"meta":{"title":"销售退款","icon":"user"},"children":[{"path":"salerefund","component":"/cashire/salerefund","name":"salerefund","meta":{"title":"销售退款","icon":"user"}}]},{"path":"/cashire","component":"Layout","hidden":false,"meta":{"title":"销售费用","icon":"user"},"children":[{"path":"salecost","component":"/cashire/salecost","name":"salecost","meta":{"title":"销售费用","icon":"user"}}]},{"path":"/cashire","component":"Layout","hidden":false,"meta":{"title":"采购费用","icon":"user"},"children":[{"path":"purchasecost","component":"/cashire/purchasecost","name":"purchasecost","meta":{"title":"采购费用","icon":"user"}}]},{"path":"/cashire","component":"Layout","hidden":false,"meta":{"title":"货款付款表","icon":"user"},"children":[{"path":"pform","component":"/cashire/pform","name":"pform","meta":{"title":"货款付款表","icon":"user"}}]},{"path":"/cashire","component":"Layout","hidden":false,"meta":{"title":"退款付款表","icon":"user"},"children":[{"path":"sform","component":"/cashire/sform","name":"sform","meta":{"title":"退款付款表","icon":"user"}}]},{"path":"/cashire","component":"Layout","hidden":false,"meta":{"title":"销售费用付款表","icon":"user"},"children":[{"path":"pcform","component":"/cashire/pcform","name":"pcform","meta":{"title":"销售费用付款表","icon":"user"}}]},{"path":"/cashire","component":"Layout","hidden":false,"meta":{"title":"采购费用付款单","icon":"user"},"children":[{"path":"scform","component":"/cashire/scform","name":"scform","meta":{"title":"采购费用付款单","icon":"user"}}]}]',
                'menu_ower' => 8
            ]
        ];


        foreach ($menu_ower_arr as $menuval) {

            $menu_ower = $menuval['menu_ower'];
            $str_arr = json_decode($menuval['str'], true);
            // print_r($str_arr);
            // continue;
            foreach ($str_arr as $val) {
                $data = [
                    'path' => $val['path'],
                    'name' => isset($val['name']) ? $val['name'] : '',
                    'component' => $val['component'],
                    'hidden' => $val['hidden'] ? 1 : 0,
                    'title' => $val['meta']['title'],
                    'icon' => isset($val['meta']['icon']) ? $val['meta']['icon'] : '',
                    'menu_ower' => $menu_ower,
                    'props' => isset($val['props']) ? json_encode($val['props']) : '',
                ];
                $pid = Menulist::create($data)->id;
                if (isset($val['children'])) {
                    foreach ($val['children'] as $children) {
                        $subdata = [
                            'path' => $children['path'],
                            'pid' => $pid,
                            'name' => isset($children['name']) ? $children['name'] : '',
                            'component' => $children['component'],
                            'hidden' => 0,
                            'title' => $children['meta']['title'],
                            'icon' => isset($children['meta']['icon']) ? $children['meta']['icon'] : '',
                            'menu_ower' => $menu_ower,
                            'props' => isset($children['props']) ? json_encode($children['props']) : '',
                        ];
                        $ppid = Menulist::create($subdata)->id;

                        if (isset($children['buttonList'])) {
                            foreach ($children['buttonList'] as $button) {
                                $buttondata = [
                                    'pid' => $ppid,
                                    'name' => $button,
                                    'menu_ower' => $menu_ower,
                                    'is_botton' => 1
                                ];
                                Menulist::create($buttondata);
                            }
                        }

                        if (isset($children['children'])) {
                            foreach ($children['children'] as $childrenchildren) {
                                $subsubdata = [
                                    'path' => $childrenchildren['path'],
                                    'pid' => $ppid,
                                    'name' => isset($childrenchildren['name']) ? $childrenchildren['name'] : '',
                                    'component' => $childrenchildren['component'],
                                    'hidden' => 0,
                                    'title' => $childrenchildren['meta']['title'],
                                    'icon' => isset($childrenchildren['meta']['icon']) ? $childrenchildren['meta']['icon'] : '',
                                    'menu_ower' => $menu_ower,
                                    'props' => isset($childrenchildren['props']) ? json_encode($childrenchildren['props']) : '',
                                ];
                                $pppid = Menulist::create($subsubdata)->id;

                                if (isset($childrenchildren['buttonList'])) {
                                    foreach ($childrenchildren['buttonList'] as $button) {
                                        $buttondata = [
                                            'pid' => $pppid,
                                            'name' => $button,
                                            'menu_ower' => $menu_ower,
                                            'is_botton' => 1
                                        ];
                                        Menulist::create($buttondata);
                                    }
                                }




                                if (isset($childrenchildren['children'])) {
                                    foreach ($childrenchildren['children'] as $childrenchildrenchildren) {
                                        $subsubdata = [
                                            'path' => $childrenchildrenchildren['path'],
                                            'pid' => $pppid,
                                            'name' => isset($childrenchildrenchildren['name']) ? $childrenchildrenchildren['name'] : '',
                                            'component' => $childrenchildrenchildren['component'],
                                            'hidden' => 0,
                                            'title' => $childrenchildrenchildren['meta']['title'],
                                            'icon' => isset($childrenchildrenchildren['meta']['icon']) ? $childrenchildrenchildren['meta']['icon'] : '',
                                            'menu_ower' => $menu_ower,
                                            'props' => isset($childrenchildrenchildren['props']) ? json_encode($childrenchildrenchildren['props']) : '',
                                        ];
                                        $ppppid = Menulist::create($subsubdata)->id;

                                        if (isset($childrenchildrenchildren['buttonList'])) {
                                            foreach ($childrenchildrenchildren['buttonList'] as $button) {
                                                $buttondata = [
                                                    'pid' => $ppppid,
                                                    'name' => $button,
                                                    'menu_ower' => $menu_ower,
                                                    'is_botton' => 1
                                                ];
                                                Menulist::create($buttondata);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (isset($val['buttonList'])) {
                    foreach ($val['buttonList'] as $button) {
                        $buttondata = [
                            'pid' => $pid,
                            'name' => $button,
                            'menu_ower' => $menu_ower,
                            'is_botton' => 1
                        ];
                        Menulist::create($buttondata);
                    }
                }
            }
            $id_arr = Manger::where(['utype' => $menu_ower])->pluck('id');
            foreach ($id_arr as $idval) {
                $this->setMangerRule($idval, $menu_ower);
            }
        }
    }

    public  function setMangerRule(int $manger_id, int $utype)
    {

        $select_arr = [
            'id',
            'pid',
            'name',
            'path',
            'props',
            'hidden',
            'component',
            'always_show',
            'title',
            'icon',
            'no_cache',
            'link',
            'is_botton',
            'menu_ower',
            'is_default as is_checked'
        ];
        $menulist = Menulist::where(['menu_ower' => $utype, 'pid' => 0])
            ->select($select_arr)->get();


        foreach ($menulist as &$val) {
            $val->meta = ['title' => $val->title, 'icon' => $val->icon];
            unset($val->title);
            unset($val->icon);
            $submenu = Menulist::where(['menu_ower' => $utype, 'pid' => $val->id, 'is_botton' => 0])->select($select_arr)->get();
            $buttonlist = Menulist::where(['menu_ower' => $utype, 'pid' => $val->id, 'is_botton' => 1])->select($select_arr)->get();
            $val->props = $val->props ? json_decode($val->props, true) : [];
            foreach ($submenu as &$vval) {
                $vval->meta = ['title' => $vval->title, 'icon' => $vval->icon];
                $vval->props = $vval->props ? json_decode($vval->props, true) : [];

                unset($vval->title);
                unset($vval->icon);
                $vval->buttonlist = Menulist::where(['menu_ower' => $utype, 'pid' => $vval->id, 'is_botton' => 1])->select($select_arr)->get();
                $subsubmenu = Menulist::where(['menu_ower' => $utype, 'pid' => $vval->id, 'is_botton' => 0])->select($select_arr)->get();
                foreach ($subsubmenu as &$vvval) {
                    $vvval->meta = ['title' => $vvval->title, 'icon' => $vvval->icon];
                    $vvval->props = $vvval->props ? json_decode($vvval->props, true) : [];

                    unset($vvval->title);
                    unset($vvval->icon);
                    $vvval->buttonlist = Menulist::where(['menu_ower' => $utype, 'pid' => $vvval->id, 'is_botton' => 1])->select($select_arr)->get();

                    $subsubsubmenu = Menulist::where(['menu_ower' => $utype, 'pid' => $vvval->id, 'is_botton' => 0])->select($select_arr)->get();
                    foreach ($subsubsubmenu as &$vvvval) {
                        $vvvval->meta = ['title' => $vvvval->title, 'icon' => $vvvval->icon];
                        $vvvval->props = $vvvval->props ? json_decode($vvvval->props, true) : [];

                        unset($vvvval->title);
                        unset($vvvval->icon);
                        $vvvval->buttonlist = Menulist::where(['menu_ower' => $utype, 'pid' => $vvvval->id, 'is_botton' => 1])->select($select_arr)->get();
                    }

                    $vvval->children = $subsubsubmenu;
                }
                $vval->children = $subsubmenu;
            }
            $val->children = $submenu;
            $val->buttonlist = $buttonlist;
        }
        //设置人员权限redis缓存

        Redis::set('manger_user_menulist_' . $manger_id, json_encode($menulist));


        Mangerrule::where(['mid' => $manger_id])->update(['ruleinfo' => json_encode($menulist)]);
    }
}
